#
# Copyright (C) 2007-2008 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=cabextract_lede
PKG_VERSION:=1.11
PKG_RELEASE:=1

PKG_SRC_NAME:=cabextract
PKG_SOURCE:=$(PKG_SRC_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.cabextract.org.uk
PKG_HASH:=b5546db1155e4c718ff3d4b278573604f30dd64c3c5bfd4657cd089b823a3ac6

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SRC_NAME)-$(PKG_VERSION)
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_SRC_NAME)-$(PKG_VERSION)

PKG_MAINTAINER:=Tobias Waldvogel <tobias.waldvogel@gmail.com>

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk

define Package/cabextract_lede
    URL:=https://www.cabextract.org.uk
    SECTION:=utils
    CATEGORY:=Printing
    SUBMENU:=Utilities
    DEPENDS:=+libbz2
    TITLE:=(LEDE) cabextract is a compression utility.
endef

define Package/cabextract_lede/description
	LEDE cabextract is Free Software for extracting Microsoft cabinet filesc
endef

export gl_cv_func_memchr_works=yes
export ac_cv_func_fnmatch_works=yes

define Package/cabextract_lede/install
	$(INSTALL_DIR) $(1)/usr/bin/
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/cabextract $(1)/usr/bin/cabextract
endef

define Host/Install
	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
	$(MAKE) -C $(HOST_BUILD_DIR) PREFIX=$(STAGING_DIR_HOSTPKG)/ install
endef

$(eval $(call BuildPackage,cabextract_lede))
$(eval $(call HostBuild))
